<template>
  <div class="form-block-inner">
    <Form
      ref="formItem"
      :rules="ruleValidate"
      :model="formItem"
      label-position="top"
    >
      <Tabs v-model="name">
        <TabPane label="基本信息" name="1">
          <div class="title-style">{{ headTitle }}</div>
          <Row :gutter="16">
            <Col span="12">
              <FormItem prop="project_name" :label="headTitlet">
                <Input
                  v-model="formItem.project_name"
                  :placeholder="'请输入' + headTitlet"
                />
              </FormItem>
            </Col>
            <Col span="9">
              <FormItem prop="settle_cycle" label="结算周期:">
                <RadioGroup v-model="formItem.settle_cycle">
                  <!-- <Radio label="1">一次性</Radio>-->
                  <Radio label="2">周结算</Radio>
                  <Radio label="3">月结算</Radio>
                  <Radio label="4">季度结算</Radio>
                  <Radio label="5">年度结算</Radio>
                  <Radio label="99">其他</Radio>
                </RadioGroup>
              </FormItem>
            </Col>
            <Col span="3">
              <template v-if="formItem.settle_cycle == '99'">
                <FormItem prop="settle_cycle_other" label="其他结算周期：">
                  <Input
                    v-model="formItem.settle_cycle_other"
                    placeholder="请输入其他结算周期"
                  />
                </FormItem>
              </template>
            </Col>
          </Row>
          <Row :gutter="16">
            <Col span="12">
              <FormItem prop="budget" label="资金预算额度:">
                <Input
                  v-model="formItem.budget"
                  type="number"
                  placeholder="请输入资金预算额度"
                >
                  <span slot="append">万元</span>
                </Input>
              </FormItem>
            </Col>
            <Col span="12">
              <FormItem prop="target_no" label="指标文号:">
                <Input
                  v-model="formItem.target_no"
                  placeholder="请输入指标文号"
                ></Input>
              </FormItem>
            </Col>
          </Row>

          <Row :gutter="16">
            <Col span="12">
              <FormItem prop="capital_source" label="资金来源:">
                <Input
                  v-model="formItem.capital_source"
                  placeholder="请输入资金来源"
                ></Input>
              </FormItem>
            </Col>
            <Col span="12">
              <FormItem prop="number" label="服务对象预计数量:">
                <Input
                  type="number"
                  v-model="formItem.number"
                  placeholder="请输入服务对象预计数量"
                ></Input>
              </FormItem>
            </Col>
          </Row>
          <!--发放部门/政策描述-->
          <Row :gutter="16">
            <Col span="12">
              <FormItem prop="department" label="发放部门:">
                <Input
                  disabled
                  v-model="formItem.department"
                  placeholder="请输入发放部门"
                ></Input>
              </FormItem>
            </Col>
            <Col span="4">
              <FormItem prop="term" label="政策有效期:">
                <RadioGroup v-model="formItem.term">
                  <Radio label="1">长期有效</Radio>
                  <Radio label="2">临时有效</Radio>
                </RadioGroup>
              </FormItem>
            </Col>
            <Col span="8" v-if="formItem.term === '2'">
              <FormItem label="临时有效期限:">
                <span>
                  <DatePicker
                    type="date"
                    v-model="formItem.temp_start_time"
                    placeholder="开始时间"
                    style="width: 173px"
                  ></DatePicker>
                  <span style="margin-left: 5px; margin-right: 5px">-</span>
                  <DatePicker
                    type="date"
                    v-model="formItem.temp_end_time"
                    placeholder="结束时间"
                    style="width: 173px"
                  ></DatePicker>
                </span>
              </FormItem>
            </Col>
          </Row>
          <!--政策依据，直达类型-->
          <Row :gutter="16">
            <Col span="12">
              <FormItem prop="serve_object" label="服务对象:">
                <Input
                  v-model="formItem.serve_object"
                  placeholder="请输入服务对象"
                ></Input>
              </FormItem>
            </Col>
            <Col span="12">
              <FormItem prop="zd_type" label="直达类型:">
                <RadioGroup v-model="formItem.zd_type">
                  <Radio label="1">依申请直达</Radio>
                  <Radio label="2">免申请直达</Radio>
                </RadioGroup>
              </FormItem>
            </Col>
          </Row>
          <!--政策有效期/服务对象-->
          <Row :gutter="16">
            <Col span="12">
              <FormItem prop="basis" label="政策依据:">
                <Input
                  v-model="formItem.basis"
                  type="textarea"
                  placeholder="请输入政策依据"
                ></Input>
              </FormItem>
            </Col>

            <Col span="12">
              <FormItem prop="describ" label="政策描述:">
                <Input
                  v-model="formItem.describ"
                  type="textarea"
                  placeholder="请输入政策描述"
                ></Input>
              </FormItem>
            </Col>
          </Row>
          <Row :gutter="16">
            <Col span="24">
              <FormItem prop="natures" label="填选择政策直达性质：">
                <Select v-model="formItem.natures" style="width: 40%" clearable>
                  <Option value="可实现政策直达">可实现政策直达</Option>
                  <Option value="需调整后实现政策直达"
                    >需调整后实现政策直达</Option
                  >
                  <Option value="暂时无法实现政策直达"
                    >暂时无法实现政策直达</Option
                  >
                </Select>
              </FormItem>
            </Col>
          </Row>
             <Row :gutter="16">
            <Col span="12">
              <FormItem prop="person" label="联系人:">
                <Input v-model="formItem.person" type="text" placeholder="请输入联系人"></Input>
              </FormItem>
            </Col>
            <Col span="12">
            <FormItem prop="phone" label="联系电话:">
                <Input v-model="formItem.phone" type="text" placeholder="请输入联系电话"></Input>
              </FormItem>
            </Col>
          </Row>
          <!--          数量情况（对象规模、 涉及资金情况fundsInvolved；-->
          <Row :gutter="16">
            <!--            9月7日去掉-->
            <!--            <Col span="12">-->
            <!--              <FormItem prop="money" label="涉及资金情况:">-->
            <!--                <Input v-model="formItem.money" placeholder="请输入涉及资金情况"></Input>-->
            <!--              </FormItem>-->
            <!--            </Col>-->
          </Row>

          <!--          <Row :gutter="16">-->
          <!--            &lt;!&ndash;        <Col span="24">&ndash;&gt;-->
          <!--            &lt;!&ndash;          <FormItem  label="结算账户：" v-model="formItem.pay_account" :required="true">&ndash;&gt;-->
          <!--            &lt;!&ndash;            <Divider  size="small">零余额账户</Divider>&ndash;&gt;-->
          <!--            &lt;!&ndash;          </FormItem>&ndash;&gt;-->
          <!--            &lt;!&ndash;        </Col>&ndash;&gt;-->

          <!--            <Col span="24">-->
          <!--              <FormItem prop="settle_account_bank" label="零余额账户开户银行：">-->
          <!--                <RadioGroup v-model="formItem.settle_account_bank">-->
          <!--                  <Radio label="盛京银行"></Radio>-->
          <!--                  <Radio label="中国工商银行"></Radio>-->
          <!--                  <Radio label="中国建设银行"></Radio>-->
          <!--                  <Radio label="中国农业银行"></Radio>-->
          <!--                  <Radio label="中国银行"></Radio>-->
          <!--                  <Radio label="中国交通银行"></Radio>-->
          <!--                  <Radio label="中国邮政储蓄银行"></Radio>-->
          <!--                  <Radio label="中信银行"></Radio>-->
          <!--                  <Radio label="光大银行"></Radio>-->
          <!--                  <Radio label="招商银行"></Radio>-->
          <!--                  <Radio label="浦发银行"></Radio>-->
          <!--                  <Radio label="民生银行"></Radio>-->
          <!--                  <Radio label="华夏银行"></Radio>-->
          <!--                  <Radio label="平安银行"></Radio>-->
          <!--                  <Radio label="兴业银行"></Radio>-->
          <!--                  <Radio label="广发银行"></Radio>-->
          <!--                  <Radio label="渤海银行"></Radio>-->
          <!--                  <Radio label="浙商银行"></Radio>-->
          <!--                  <Radio label="恒丰银行"></Radio>-->
          <!--                  <Radio label="其他"></Radio>-->
          <!--                  <div v-if="formItem.settle_account_bank == '其他'" class="other-style">-->
          <!--                    <Input v-model="formItem.other_settle_account_bank"  placeholder="请输入零余额账户开户银行"/>-->
          <!--                  </div>-->
          <!--                </RadioGroup>-->
          <!--              </FormItem>-->
          <!--            </Col>-->
          <!--          </Row>-->

          <!--          9月7日改-->
          <div class="title-style">资金结算开户行</div>
          <Row :gutter="16">
            <Col span="4">
              <CheckboxGroup
                v-model="formItem.banks_status"
                @on-change="selectOptionTwo"
                placeholder="请选择支付银行"
                class="wer"
              >
                <Checkbox label="零余额账户开户银行"></Checkbox>
                <Checkbox label="实体账户支付银行"></Checkbox>
              </CheckboxGroup>
            </Col>
            <Col span="12">
              <div class="other-style">
                <FormItem prop="other_settle_account_bank" v-if="showCheck1">
                  <Input
                    v-model="formItem.other_settle_account_bank"
                    placeholder="请输入零余额账户开户银行"
                  />
                </FormItem>
              </div>
              <div class="other-style">
                <FormItem prop="other_pay_account_banks" v-if="showCheck2">
                  <Input
                    v-model="formItem.other_pay_account_banks"
                    placeholder="请输入实体账户支付银行"
                  />
                </FormItem>
              </div>
            </Col>
          </Row>

          <!--          <Row :gutter="16">-->
          <!--            &lt;!&ndash;        <Col span="24">&ndash;&gt;-->
          <!--            &lt;!&ndash;          <Divider  size="small">实体账户</Divider>&ndash;&gt;-->
          <!--            &lt;!&ndash;        </Col>&ndash;&gt;-->
          <!--            <Col span="24">-->
          <!--              <FormItem prop="pay_account_banks" label="实体账户支付银行：">-->
          <!--                <CheckboxGroup v-model="formItem.pay_account_banks" @on-change="selectOptionTwo" placeholder="请选择支付银行">-->
          <!--                  <Checkbox label="盛京银行"></Checkbox>-->
          <!--                  <Checkbox label="中国工商银行"></Checkbox>-->
          <!--                  <Checkbox label="中国建设银行"></Checkbox>-->
          <!--                  <Checkbox label="中国农业银行"></Checkbox>-->
          <!--                  <Checkbox label="中国银行"></Checkbox>-->
          <!--                  <Checkbox label="中国交通银行"></Checkbox>-->
          <!--                  <Checkbox label="中国邮政储蓄银行"></Checkbox>-->
          <!--                  <Checkbox label="中信银行"></Checkbox>-->
          <!--                  <Checkbox label="光大银行"></Checkbox>-->
          <!--                  <Checkbox label="招商银行"></Checkbox>-->
          <!--                  <Checkbox label="浦发银行"></Checkbox>-->
          <!--                  <Checkbox label="民生银行"></Checkbox>-->
          <!--                  <Checkbox label="华夏银行"></Checkbox>-->
          <!--                  <Checkbox label="平安银行"></Checkbox>-->
          <!--                  <Checkbox label="兴业银行"></Checkbox>-->
          <!--                  <Checkbox label="广发银行"></Checkbox>-->
          <!--                  <Checkbox label="渤海银行"></Checkbox>-->
          <!--                  <Checkbox label="浙商银行"></Checkbox>-->
          <!--                  <Checkbox label="恒丰银行"></Checkbox>-->
          <!--                  <Checkbox label="其他"></Checkbox>-->
          <!--                  <div v-if="showCheck" class="other-style">-->
          <!--                    <Input v-model="formItem.other_pay_account_banks"  placeholder="请输入实体账户支付银行"/>-->
          <!--                  </div>-->
          <!--                </CheckboxGroup>-->
          <!--              </FormItem>-->
          <!--            </Col>-->
          <!--          </Row>-->
          <Row :gutter="16">
            <!--        <Col span="24">-->
            <!--          <Divider  size="small">市财政直接拨付</Divider>-->
            <!--        </Col>-->
            <!--            <Col span="24">-->
            <!--              <FormItem  prop="settle_account_direct" label="市财政直接拨付：">-->
            <!--                <CheckboxGroup v-model="formItem.settle_account_direct">-->
            <!--                  <Checkbox label="1">市财政直接拨付</Checkbox>-->
            <!--                </CheckboxGroup>-->
            <!--              </FormItem>-->
            <!--            </Col>-->
            <Col span="24" style="margin-top: 20px">
              <FormItem prop="project_instruction" label="项目说明：">
                <Input
                  v-model="formItem.project_instruction"
                  type="textarea"
                  :autosize="{ minRows: 3, maxRows: 5 }"
                  placeholder="请输入项目说明"
                ></Input>
              </FormItem>
            </Col>
          </Row>
          <Row
            ><Button
              type="primary"
              style="margin-top: 10px"
              v-if="updateStatus === '1'"
              @click="tabsChange(name)"
              >下一步</Button
            ></Row
          >
        </TabPane>
        <TabPane label="事项规则" name="2" :value="tabs">
          <!--规则-->
          <Col span="24">
            <div class="title-style">设定规则</div>
            <div v-for="(item, index) in dataList" :key="index">
              <Row :gutter="20">
                <Col span="10">
                  <FormItem label="规则内容：" prop="gz_content">
                    <Input
                      v-model="item.gz_content"
                      type="textarea"
                      :autosize="{ minRows: 2, maxRows: 3 }"
                      placeholder="请填写规则内容"
                    ></Input>
                  </FormItem>
                  <!--                <FormItem class="required" label="规则内容：" prop="gz_content">-->
                  <!--                  <Input  v-model="item.gz_content" placeholder="请填写规则内容"></Input>-->
                  <!--                </FormItem>-->
                </Col>
                <Col span="10">
                  <FormItem label="规则依据：" prop="gz_yi_ju">
                    <Input
                      v-model="item.gz_yi_ju"
                      type="textarea"
                      :autosize="{ minRows: 2, maxRows: 3 }"
                      placeholder="请填写规则依据的文件内容"
                    ></Input>
                  </FormItem>
                </Col>
              </Row>
              <Row :gutter="20">
                <Col span="10">
                  <FormItem class="required" prop="gz_type" label="规则类型:">
                    <RadioGroup v-model="item.gz_type">
                      <Radio label="1">必要</Radio>
                      <Radio label="2">联合</Radio>
                      <Radio label="3">附加</Radio>
                    </RadioGroup>
                  </FormItem>
                </Col>
                <!-- <Col span="11">
                  <FormItem label=" " class="col-last-btn">
                    <Button @click="delAction(index)" type="error" shape="circle" icon="md-close"></Button>
                  </FormItem>

                </Col> -->
              </Row>
              <Row v-if="item.gz_type == 2">
                <Col span="20">
                  <FormItem class="required" label="联合规则：" prop="lh_yi_ju">
                    <Input
                      v-model="item.lh_yi_ju"
                      type="textarea"
                      :autosize="{ minRows: 2, maxRows: 3 }"
                      placeholder="选择联合时,请填写不同规则间的关联关系"
                    ></Input>
                  </FormItem>
                </Col>
              </Row>
              <Divider class="mt10" />
            </div>
          </Col>
        </TabPane>
        <TabPane label="事项条件" name="3" :value="tabs">
          <!--              条件-->
          <Col span="24">
            <div class="title-style">设定条件</div>
            <div v-for="(item, index) in wheredataList" :key="index">
              <Row :gutter="20">
                <Col span="10">
                  <FormItem
                    class="required"
                    label="条件内容："
                    prop="tj_content"
                  >
                    <Input
                      v-model="item.tj_content"
                      type="textarea"
                      :autosize="{ minRows: 2, maxRows: 3 }"
                      placeholder="请填写条件内容。如：年龄、户籍等限制条件"
                    ></Input>
                  </FormItem>
                  <!--                <FormItem class="required" label="条件内容：" prop="tj_content">-->
                  <!--                  <Input v-model="item.tj_content" placeholder="请填写条件内容。如：年龄、户籍等限制条件"></Input>-->
                  <!--                </FormItem>-->
                </Col>
                <Col span="10">
                  <FormItem label="条件依据：" prop="tj_yi_ju">
                    <Input
                      v-model="item.tj_yi_ju"
                      type="textarea"
                      :autosize="{ minRows: 2, maxRows: 3 }"
                      placeholder="请填写条件依据的文件内容"
                    ></Input>
                  </FormItem>
                </Col>
              </Row>
              <Row :gutter="20">
                <Col span="10">
                  <FormItem
                    class="required"
                    prop="tj_xian_zhi"
                    label="条件限制:"
                  >
                    <RadioGroup v-model="item.tj_xian_zhi">
                      <Radio label="1">必要</Radio>
                      <Radio label="2">联合</Radio>
                      <Radio label="3">附加</Radio>
                    </RadioGroup>
                  </FormItem>
                </Col>
                <!-- <Col span="11">

                  <FormItem label=" " class="col-last-btn">
                    <Button @click="wheredelAction(index)" type="error" shape="circle" icon="md-close"></Button>
                  </FormItem>
                </Col> -->
              </Row>
              <Row v-if="item.tj_xian_zhi == 2">
                <Col span="20">
                  <FormItem class="required" label="联合条件：" prop="lh_yi_ju">
                    <Input
                      v-model="item.lh_yi_ju"
                      type="textarea"
                      :autosize="{ minRows: 2, maxRows: 3 }"
                      placeholder="选择联合时,请填写不同条件间的关联关系"
                    ></Input>
                  </FormItem>
                </Col>
              </Row>
              <Divider class="mt10" />
            </div>
            <Row>
              <Col span="24">
                <!-- <Button type="success" @click="whereadd">添加</Button> -->
              </Col>
            </Row>
          </Col>
        </TabPane>
        <TabPane label="事项要件" name="4">
          <!--              要件-->
          <Col span="24">
            <div class="title-style">设定要件</div>
            <div v-for="(item, index) in yaojiandataList" :key="index">
              <Row :gutter="24">
                <Col span="10">
                  <FormItem class="required" prop="yj_title" label="要件名称:">
                    <Input
                      v-model="item.yj_title"
                      placeholder="请填写要件名称"
                    ></Input>
                  </FormItem>
                </Col>
                <Col span="7">
                  <FormItem class="required" prop="yj_type" label="要件类型:">
                    <Select v-model="item.yj_type" style="width: 100%">
                      <!--<Option value="表单">表单</Option>-->
                      <Option value="1">附件</Option>
                      <Option value="2">制式电子表单</Option>
                      <Option value="3">制式电子文本</Option>
                    </Select>
                  </FormItem>
                </Col>
                <Col span="6">
                  <FormItem prop="yi_img_demo" label="要件样本:">
                    <Button
                      icon="ios-cloud-upload-outline"
                      style="width: 46%"
                      @click="uploadImgAction(item, index)"
                      >样本</Button
                    >
                    <span class="upload-icon">
                      <Icon
                        type="md-checkmark-circle"
                        size="18"
                        v-if="item.yi_img_demo"
                        color="green"
                      />
                      <Icon
                        type="md-close-circle"
                        size="18"
                        v-else
                        color="red"
                      />
                    </span>
                  </FormItem>
                </Col>
                <template v-if="item.yj_type == '1'">
                  <Col span="8">
                    <FormItem
                      class="required"
                      prop="is_fu_yong"
                      label="是否可复用要件:"
                    >
                      <RadioGroup v-model="item.is_fu_yong">
                        <Radio label="是"></Radio>
                        <Radio label="否"></Radio>
                      </RadioGroup>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem
                      class="required"
                      prop="is_xian_chang_cai_ji"
                      label="是否现场采集:"
                    >
                      <RadioGroup v-model="item.is_xian_chang_cai_ji">
                        <Radio label="是"></Radio>
                        <Radio label="否"></Radio>
                      </RadioGroup>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem prop="file_type" label="上传方式:">
                      <CheckboxGroup
                        v-model="item.file_type"
                        @on-change="checkBoxChange"
                      >
                        <Checkbox label="JPG"></Checkbox>
                        <Checkbox label="PNG"></Checkbox>
                        <Checkbox label="PDF"></Checkbox>
                        <Checkbox label="Word"></Checkbox>
                        <Checkbox label="Excel"></Checkbox>
                      </CheckboxGroup>
                    </FormItem>
                  </Col>
                </template>
              </Row>
              <Row :gutter="20" class="row-m-t">
                <Col span="10">
                  <FormItem label="要件依据：" prop="tj_yi_ju">
                    <Input
                      v-model="item.yj_yi_ju"
                      type="textarea"
                      :autosize="{ minRows: 2, maxRows: 3 }"
                      placeholder="请填写要件依据的文件内容"
                    ></Input>
                  </FormItem>
                  <!--                <FormItem prop="" label="要件依据:">-->
                  <!--                  <Input  placeholder="请填写要件依据的文件内容" v-model="item.yj_yi_ju"></Input>-->
                  <!--                </FormItem>-->
                </Col>
                 <Col span="5">
                 </Col>
                <Col span="6">
                  <FormItem >
                      <span style="font-weight:bold;color:red;font-family:'微软雅黑'">审查结果：</span>
                    <Select v-model="item.science">
                    <Option value="0">无</Option>
                      <Option value="1">共享</Option>
                      <Option value="2">企业提供</Option>
                      <Option value="3">承诺书代替</Option>
                    </Select>
                  </FormItem>
                </Col>

                <!-- <Col span="11">
                  <FormItem label=" " class="col-last-btn">
                    <Button @click="yaojiandelAction(index)" type="error" shape="circle" icon="md-close"></Button>
                  </FormItem>
                </Col> -->
                <Divider class="mt10" />
              </Row>
            </div>
            <Row>
              <Col span="24">
                <!-- <Button type="success" @click="yaojianadd">审查完成</Button> -->
                <Button type="success" @click="checkTrue(item)"
                  v-show="yaojiandataList.length>0">审查完成</Button
                >
              </Col>
            </Row>
            <div class="upload">
              <import-imgs
                ref="imgService"
                :index="yaojiancurrentIndex"
                @result="importImgsResultAction"
              ></import-imgs>
            </div>
          </Col>
        </TabPane>
        <TabPane label="数据需求明细" name="5" :value="tabs">
          <!--              数据需求明细-->
          <Col span="24">
            <div class="title-style">数据需求明细</div>
            <div v-for="(item, index2) in detailList" :key="index2">
              <Row :gutter="24">
                <Col span="8">
                  <FormItem
                    class="required"
                    label="数据名称："
                    prop="data_name"
                  >
                    <Input
                      v-model="item.data_name"
                      placeholder="请填写数据名称"
                    ></Input>
                  </FormItem>
                </Col>
                <Col span="8">
                  <FormItem
                    class="required"
                    label="数据来源单位："
                    prop="data_source_unit"
                  >
                    <Input
                      v-model="item.data_source_unit"
                      placeholder="请填写数据来源单位"
                    ></Input>
                  </FormItem>
                </Col>
                <Col span="8">
                  <FormItem
                    class="required"
                    label="数据库情况："
                    prop="database_situation"
                  >
                    <Input
                      v-model="item.database_situation"
                      placeholder="请填写数据库情况"
                    ></Input>
                  </FormItem>
                </Col>
              </Row>
              <Row :gutter="24">
                <Col span="20">
                  <!-- <Button type="success" @click="detailadd(index2)" style="margin-bottom: 5px">添加字段</Button> -->
                  <Table
                    border
                    :columns="columnsdetail"
                    :data="item.data_content"
                  >
                    <!-- <template slot-scope="{ row, index }" slot="action">
                      <Button type="primary" size="small" style="margin-right: 5px" @click="detailedit(row,index,index2)">编辑</Button>
                      <Button type="error" size="small" @click="detailremove(index,index2)">删除</Button>
                    </template> -->
                  </Table>
                  <Modal
                    v-model="modaldetail"
                    :title="modaldetailTi"
                    :type="modaldetailTy"
                    @on-ok="detailok(index2)"
                    @on-cancel="detailcancel"
                  >
                    <Form :model="formItemdetail" :label-width="100">
                      <FormItem label="具体字段:">
                        <Input
                          v-model="formItemdetail.specific_field"
                          placeholder="请输入具体字段"
                        ></Input>
                      </FormItem>
                      <FormItem label="字段使用规则:">
                        <Input
                          v-model="formItemdetail.specific_ruler"
                          placeholder="请输入字段使用规则"
                        ></Input>
                      </FormItem>
                    </Form>
                  </Modal>
                </Col>
                <!-- <Col span="4">

                  <FormItem label=" " class="col-last-btn">
                    <Button @click="detaildelAction(index2)" type="error" shape="circle" icon="md-close"></Button>
                  </FormItem>
                </Col> -->
              </Row>
              <Divider class="mt10" />
            </div>
            <Row>
              <Col span="24">
                <!-- <Button type="success" @click="detailadd1">添加</Button> -->
              </Col>
            </Row>
          </Col>
        </TabPane>
        <TabPane label="公示要求" name="6" :value="tabs">
          <!--              公示要求-->
          <Col span="24">
            <div class="title-style">公示要求</div>
            <div v-for="(item, index) in publicList" :key="index">
              <Row :gutter="20">
                <Col span="4">
                  <FormItem label="是否需要公示：">
                    <RadioGroup v-model="item.is_public">
                      <Radio label="1">是</Radio>
                      <Radio label="0">否</Radio>
                    </RadioGroup>
                  </FormItem>
                </Col>
                <Col span="10" v-if="item.is_public !== '0'">
                  <FormItem label="公示时长：">
                    <Input
                      v-model="item.public_start_time"
                      placeholder="请填写公示时长"
                    />
                    <!--                    <DatePicker type="date" v-model="item.public_start_time" placeholder="公示开始时间" style="width: 200px"></DatePicker>-->
                    <!--                    <span style="margin-left: 5px;margin-right: 5px">-</span>-->
                    <!--                    <DatePicker type="date" v-model="item.public_end_time" placeholder="公示结束时间" style="width: 200px"></DatePicker>-->
                  </FormItem>
                  <!--                  <FormItem label="公示时长：">-->
                  <!--                    <DatePicker type="date" v-model="item.public_start_time" placeholder="公示开始时间" style="width: 200px"></DatePicker>-->
                  <!--                    <span style="margin-left: 5px;margin-right: 5px">-</span>-->
                  <!--                    <DatePicker type="date" v-model="item.public_end_time" placeholder="公示结束时间" style="width: 200px"></DatePicker>-->
                  <!--                  </FormItem>-->
                </Col>
                <Col span="10" v-if="item.is_public !== '0'">
                  <FormItem label="其他公示要求：" prop="tj_yi_ju">
                    <Input
                      style="width: 83%"
                      v-model="item.other_publicity_requirements"
                      type="textarea"
                      :autosize="{ minRows: 2, maxRows: 3 }"
                      placeholder="请填写其他公示要求"
                    ></Input>
                  </FormItem>
                </Col>
              </Row>
              <!-- <Button v-if="item.is_public !=='0'" type="success" @click="publicadd" style="margin-bottom: 5px">添加字段</Button> -->
              <Table
                border
                :columns="columnsPublic"
                :data="item.field"
                v-if="item.is_public !== '0'"
              >
                <!-- <template slot-scope="{ row, index }" slot="action">
                  <Button type="primary" size="small" style="margin-right: 5px" @click="edit(row,index)">编辑</Button>
                </template> -->
              </Table>
              <Modal
                v-model="modalPublic"
                :title="modalTi"
                :type="modalTy"
                @on-ok="ok"
                @on-cancel="cancel"
              >
                <Form :model="formItemPublic" :label-width="100">
                  <FormItem label="字段英文名:">
                    <Input
                      v-model="formItemPublic.name_en"
                      placeholder="请输入字段英文名"
                    ></Input>
                  </FormItem>
                  <FormItem label="字段中文名:">
                    <Input
                      v-model="formItemPublic.name_zn"
                      placeholder="请输入字段中文名"
                    ></Input>
                  </FormItem>
                </Form>
              </Modal>
            </div>
          </Col>
        </TabPane>
        <TabPane label="监督节点" name="7" :value="tabs">
          <!--              监督节点-->
          <Col span="24">
            <div class="title-style">监督节点</div>
            <div v-for="(item, index) in supervisedataList" :key="index">
              <Row :gutter="20">
                <Col span="8">
                  <FormItem
                    class="required"
                    label="风险点名称："
                    prop="risk_name"
                  >
                    <Input
                      v-model="item.risk_name"
                      type="textarea"
                      :autosize="{ minRows: 2, maxRows: 3 }"
                      placeholder="请填写风险点名称"
                    ></Input>
                  </FormItem>
                </Col>
                <Col span="8">
                  <FormItem label="应对措施：" prop="countermeasures">
                    <Input
                      v-model="item.countermeasures"
                      type="textarea"
                      :autosize="{ minRows: 2, maxRows: 3 }"
                      placeholder="请填写应对措施"
                    ></Input>
                  </FormItem>
                </Col>
                <!-- <Col span="4">
                  <FormItem label=" " class="col-last-btn">
                    <Button @click="supervisedelAction(index)" type="error" shape="circle" icon="md-close"></Button>
                  </FormItem>
                </Col> -->
              </Row>
              <Divider class="mt10" />
            </div>
            <Row>
              <Col span="24">
                <!-- <Button type="success" @click="superviseadd">添加</Button> -->
              </Col>
            </Row>
          </Col>
        </TabPane>
        <TabPane label="数据统计" name="8" :value="tabs">
          <Col span="24">
            <div class="title-style">数据统计</div>
            <div v-for="(item, index2) in statisList" :key="index2">
              <Row :gutter="24">
                <Col span="12">
                  <FormItem
                    class="required"
                    label="统计项："
                    prop="statistical_item"
                  >
                    <Input
                      v-model="item.statistical_item"
                      placeholder="请填写统计项"
                    ></Input>
                  </FormItem>
                </Col>
                <Col span="12">
                  <FormItem
                    class="required"
                    label="统计纬度："
                    prop="statistical_dimension"
                  >
                    <Input
                      v-model="item.statistical_dimension"
                      placeholder="请填写统计纬度"
                    ></Input>
                  </FormItem>
                </Col>
              </Row>

              <Row :gutter="24">
                <Col span="12">
                  <FormItem
                    class="required"
                    label="统计项数据来源："
                    prop="data_sources"
                  >
                    <Input
                      v-model="item.data_sources"
                      placeholder="请填写统计项数据来源"
                    ></Input>
                  </FormItem>
                </Col>
                <Col span="12">
                  <FormItem
                    class="required"
                    label="呈现方式："
                    prop="presentation_mode"
                  >
                    <Input
                      v-model="item.presentation_mode"
                      placeholder="请填写呈现方式"
                    ></Input>
                  </FormItem>
                </Col>
              </Row>

              <Row :gutter="24">
                <Col span="20">
                  <!-- <Button type="success" @click="statisadd(index2)" style="margin-bottom: 5px">添加字段</Button> -->
                  <Table
                    border
                    :columns="columnsstatis"
                    :data="item.data_content"
                  >
                    <!-- <template slot-scope="{ row, index }" slot="action">
                      <Button type="primary" size="small" style="margin-right: 5px" @click="statisedit(row,index,index2)">编辑</Button>
                      <Button type="error" size="small" @click="statisremove(row,index,index2)">删除</Button>
                    </template> -->
                  </Table>
                  <Modal
                    v-model="modalstatis"
                    :title="modalstatisTi"
                    :type="modalstatisTy"
                    @on-ok="statisok(index2)"
                    @on-cancel="statiscancel"
                  >
                    <Form :model="formItemstatis" :label-width="100">
                      <FormItem label="字段名称:">
                        <Input
                          v-model="formItemstatis.field_name"
                          placeholder="请输入字段名称"
                        ></Input>
                      </FormItem>
                      <FormItem label="单位:">
                        <Input
                          v-model="formItemstatis.company"
                          placeholder="请输入单位"
                        ></Input>
                      </FormItem>
                    </Form>
                  </Modal>
                </Col>
                <!-- <Col span="4">

                  <FormItem label=" " class="col-last-btn">
                    <Button @click="statisdelAction(index2)" type="error" shape="circle" icon="md-close"></Button>
                  </FormItem>
                </Col> -->
              </Row>
              <Divider class="mt10" />
            </div>
            <Row>
              <Col span="24">
                <!-- <Button type="success" @click="statisadd1">添加</Button> -->
              </Col>
            </Row>
            <!-- <Row><Button type="primary" style="margin-top: 10px" v-if="updateStatus==='1'" @click="tabsChange(name)">下一步</Button></Row>
            <Row><Button type="primary" style="margin-top: 10px" v-if="updateStatus==='2'" @click="editBtnAction('sjtj')" :loading="btnLoading">保存数据</Button></Row> -->
          </Col>
        </TabPane>
      </Tabs>
    </Form>
  </div>
</template>

<script>
import {
  insert,
  selectById,
  projectUpdate,
  updateSalaryAnnualProjectFund,
  updateSstGovWhere,
  updateSstGovRule,
  updateSstGovYaojian,
  updateDataRequirementDetails,
  updatePublicityRequirements,
  updateSupervisionNode,
  updateDataStatistics,
  updateSstGovYaojianScience,
} from "@/api/setting/private";
import "@/assets/css/link.css";
import ImportImgs from "../../capital-manage/project-capital/CreateMoney/components/yaojian-setting/components/import-imgs";
export default {
  components: {
    ImportImgs,
  },
  data() {
    const validateProjectName = (rule, value, callback) => {
      if (value === "" || value === null || value === undefined) {
        callback(new Error(this.headTitlet + "不能为空"));
      } else {
        callback();
      }
    };
      const checkPhopne = (rule,value,callback) =>{
       const tel = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
       if(!tel.test(this.formItem.phone)){
         callback(new Error("请输入正确手机号码"))
       }else{
         callback()
       }
    }
    return {
      tabs: "",
      tableData: [],
      statisList: [], // 数据统计
      detailList: [], // 数据需求明细
      cnum: "", // 当前弹窗操作的index
      cnumstatis: "", // 当前弹窗操作的index
      timedataList: [{ gov_base_id: this.$route.query.id }], // 时限
      yaojiandataList: [], // 要件
      yaojiannodeList: [], // 要件
      yaojiancurrentIndex: 0, // 要件
      wheredataList: [], // 条件
      wherenodeList: [], // 条件
      dataList: [], // rouler
      nodeList: [], // rouler
      tipTitle: "指事项各个节点上报、审核或审批时应该遵循的规则。", // rouler
      flowDataList: [],
      tabName: "",
      baseInfoId: "",
      showSubobj: false,
      showSubway: false,
      showSetto: false,
      showCheckOne: false,
      showCheck1: false,
      showCheck2: false,
      showCheckThree: false,
      ruleValidate: {
        other_settle_account_bank: [
          { required: true, message: "零余额账户开户银行", trigger: "blur" },
        ],
        other_settle_account_banks: [
          { required: true, message: "请输入其结算银行", trigger: "blur" },
        ],
        other_pay_account_banks: [
          {
            required: true,
            message: "请输入实体账户支付银行",
            trigger: "blur",
          },
        ],
        other_pay_account_bank: [
          {
            required: true,
            message: "请输入其支付银行",
            trigger: "blur",
          },
        ],
         person: [
          { required: true, message: '联系人不能为空', trigger: 'blur' }
        ],
         phone:[
          {
            required:true, validator:checkPhopne,trigger:'blur'
          }
        ],
        other_subsidy_bank: [
          { required: true, message: "请输入其结算银行", trigger: "blur" },
        ],
        project_name: [
          // { required: true, message: '事项名称不能为空', trigger: 'blur' }
          { required: true, validator: validateProjectName, trigger: "blur" },
        ],
        natures: [
          { required: true, message: "请选择政策直达性质", trigger: "change" },
        ],
        project_type: [
          { required: true, message: "补贴类型不能为空", trigger: "change" },
        ],
        project_type_build: [
          { required: true, message: "建设类项目不能为空", trigger: "change" },
        ],
        project_type_other: [
          { required: true, message: "其他项目类型不能为空", trigger: "blur" },
        ],
        budget: [
          { required: true, message: "请填写正确金额", trigger: "blur" },
        ],
        capital_source: [
          { required: true, message: "资金来源不能为空", trigger: "blur" },
        ],
        // target_no: [
        //   { required: true, message: '指标文号不能为空', trigger: 'blur' }
        // ],
        department: [
          { required: true, message: "发放部门不能为空", trigger: "blur" },
        ],
        basis: [
          { required: true, message: "政策依据不能为空", trigger: "blur" },
        ],
        zd_type: [
          { required: true, message: "直达类型不能为空", trigger: "change" },
        ],
        term: [
          { required: true, message: "政策有效期不能为空", trigger: "change" },
        ],
        money: [
          { required: true, message: "涉及资金情况不能为空", trigger: "blur" },
        ],
        number: [
          { required: true, message: "数量情况不能为空", trigger: "blur" },
        ],
        serve_object: [
          { required: true, message: "服务对象不能为空", trigger: "blur" },
        ],
        describ: [
          { required: true, message: "政策描述不能为空", trigger: "blur" },
        ],
        capital_source_other: [
          { required: true, message: "其他来源不能为空", trigger: "blur" },
        ],
        // project_cycle: [
        //   { required: true, message: '项目周期不能为空', trigger: 'blur' }
        // ],
        issue_cycle: [
          { required: true, message: "发放周期不能为空", trigger: "change" },
        ],
        issue_cycle_other: [
          { required: true, message: "其他发放周期不能为空", trigger: "blur" },
        ],
        settle_cycle: [
          { required: true, message: "结算周期不能为空", trigger: "change" },
        ],
        settle_cycle_other: [
          { required: true, message: "其他结算周期不能为空", trigger: "blur" },
        ],
        subsidy_object: [
          {
            required: true,
            type: "array",
            min: 1,
            message: "补贴对象不能为空",
            trigger: "change",
          },
        ],
        subsidy_object_other: [
          { required: true, message: "其他补贴对象不能为空", trigger: "blur" },
        ],
        settle_object: [
          {
            required: true,
            type: "array",
            min: 1,
            message: "结算对象不能为空",
            trigger: "change",
          },
        ],
        settle_object_other: [
          { required: true, message: "其他结算对象不能为空", trigger: "blur" },
        ],
        subsidy_way: [
          {
            required: true,
            type: "array",
            min: 1,
            message: "补贴方式不能为空",
            trigger: "change",
          },
        ],
        subsidy_way_other: [
          { required: true, message: "其他补贴方式不能为空", trigger: "blur" },
        ],
        // subsidy_bank: [
        //   { required: true, type: 'array', min: 1, message: '补贴代发银行不能为空', trigger: 'change' }
        // ]
        // pay_account: [
        //   { required: true, message: '支付账户不能为空', trigger: 'change' }
        // ],
        // pay_account_bank: [
        //   { required: true, message: '支付银行不能为空', trigger: 'change' }
        // ],
        // pay_account_banks: [
        //   { required: true, type: 'array', min: 1, message: '支付银行不能为空', trigger: 'change' }
        // ],
        // settle_account: [
        //   { required: true, message: '结算账户不能为空', trigger: 'change' }
        // ],
        // settle_account_bank: [
        //   { required: true, message: '结算银行不能为空', trigger: 'change' }
        // ],
        // settle_account_banks: [
        //   { required: true, type: 'array', min: 1, message: '结算银行不能为空', trigger: 'change' }
        // ]
      },
      formItem: {},
      btnLoading: false,
      projectSource: [
        {
          value: "1",
          label: "国家",
        },
        {
          value: "2",
          label: "市本级财政资金",
        },
        {
          value: "3",
          label: "区县",
        },
        {
          value: "99",
          label: "其他",
        },
      ],
      payBank: [
        {
          value: "中国工商银行",
          label: "中国工商银行",
        },
        {
          value: "中国建设银行",
          label: "中国建设银行",
        },
        {
          value: "中国农业银行",
          label: "中国农业银行",
        },
        {
          value: "中国银行",
          label: "中国银行",
        },
        {
          value: "中国交通银行",
          label: "中国交通银行",
        },
        {
          value: "中国邮政储蓄银行",
          label: "中国邮政储蓄银行",
        },
        {
          value: "中信银行",
          label: "中信银行",
        },
        {
          value: "光大银行",
          label: "光大银行",
        },
        {
          value: "招商银行",
          label: "招商银行",
        },
        {
          value: "浦发银行",
          label: "浦发银行",
        },
        {
          value: "民生银行",
          label: "民生银行",
        },
        {
          value: "华夏银行",
          label: "华夏银行",
        },
        {
          value: "平安银行",
          label: "平安银行",
        },
        {
          value: "兴业银行",
          label: "兴业银行",
        },
        {
          value: "广发银行",
          label: "广发银行",
        },
        {
          value: "渤海银行",
          label: "渤海银行",
        },
        {
          value: "浙商银行",
          label: "浙商银行",
        },
        {
          value: "恒丰银行",
          label: "恒丰银行",
        },
        {
          value: "盛京银行",
          label: "盛京银行",
        },
      ],
      settleBank: [
        {
          value: "中国工商银行",
          label: "中国工商银行",
        },
        {
          value: "中国建设银行",
          label: "中国建设银行",
        },
        {
          value: "中国农业银行",
          label: "中国农业银行",
        },
        {
          value: "中国银行",
          label: "中国银行",
        },
        {
          value: "中国交通银行",
          label: "中国交通银行",
        },
        {
          value: "中国邮政储蓄银行",
          label: "中国邮政储蓄银行",
        },
        {
          value: "中信银行",
          label: "中信银行",
        },
        {
          value: "光大银行",
          label: "光大银行",
        },
        {
          value: "招商银行",
          label: "招商银行",
        },
        {
          value: "浦发银行",
          label: "浦发银行",
        },
        {
          value: "民生银行",
          label: "民生银行",
        },
        {
          value: "华夏银行",
          label: "华夏银行",
        },
        {
          value: "平安银行",
          label: "平安银行",
        },
        {
          value: "兴业银行",
          label: "兴业银行",
        },
        {
          value: "广发银行",
          label: "广发银行",
        },
        {
          value: "渤海银行",
          label: "渤海银行",
        },
        {
          value: "浙商银行",
          label: "浙商银行",
        },
        {
          value: "恒丰银行",
          label: "恒丰银行",
        },
        {
          value: "盛京银行",
          label: "盛京银行",
        },
      ],
      optionType: "add",
      projectID: "",
      rtobj: {},
      salatype: "",
      headTitle: "",
      headTitlet: "",
      name: "1",
      formItemPublic: {},
      formItemdetail: {},
      formItemstatis: {},
      publicdataList: [], // 公示,
      publicList: [
        {
          field: [],
        },
      ], // 公示2,
      columnsPublic: [
        {
          title: "字段英文名",
          key: "name_en",
          align: "center",
        },
        {
          title: "字段中文名",
          key: "name_zn",
          align: "center",
        },
        // {
        //   title: '操作',
        //   slot: 'action',
        //   width: 150,
        //   align: 'center'
        // }
      ], // 公示里列表头
      columnsdetail: [
        {
          title: "具体字段",
          key: "specific_field",
          align: "center",
        },
        {
          title: "字段使用规则",
          key: "specific_ruler",
          align: "center",
        },
        // {
        //   title: '操作',
        //   slot: 'action',
        //   width: 150,
        //   align: 'center'
        // }
      ], // datail里列表头
      columnsstatis: [
        {
          title: "字段名称",
          key: "field_name",
          align: "center",
        },
        {
          title: "单位",
          key: "company",
          align: "center",
        },
        // {
        //   title: '操作',
        //   slot: 'action',
        //   width: 150,
        //   align: 'center'
        // }
      ], // 最后里列表头
      dataPublic: [],
      modalPublic: false,
      modaldetail: false,
      modalstatis: false,
      modalTi: "",
      modalTy: "",
      modaldetailTi: "",
      modaldetailTy: "",
      modalstatisTi: "",
      modalstatisTy: "",
      cindex: "",
      cindexdetail: "",
      cindexstatis: "",
      supervisedataList: [], // 监督
      updateStatus: "1",
      // 定义各个tab页id
      baseId: "1d379ebcfcde11eb88110242ac110002", // 基础信息
      ruleId: "", // 规则
      whereId: "", // 条件
      yaojianId: "", // 要件
      sjxqId: "", // 数据需求明细
      publicId: "", // 公示要求
      jianduId: "", // 监督节点
      sjtjId: "", // 数据统计,
      formItempub: {},
      // 校验
    };
  },
  mounted() {
    if (this.$route.query.id) {
      this.projectID = this.$route.query.id;
      this.optionType = "edit";
      this.getInfoByID();
    } else {
      this.optionType = "add";
    }
    if (this.$route.query.zjtype) {
      console.log(this.$route.query.zjtype, "zjtypeWWW");
      this.salatype = this.$route.query.zjtype;
      if (this.salatype === "1") {
        this.headTitle = "惠民资金";
        this.headTitlet = "惠民直达事项名称";
      }
      if (this.salatype === "2") {
        this.headTitle = "惠企资金";
        this.headTitlet = "惠企直达事项名称";
      }
    }
    this.baseInfoId = this.$route.query.id
      ? this.$route.query.id
      : this.baseInfoId;
    this.formItem.department =
      this.$store.state.user.severUserInfo.data.company_name;
  },
  methods: {
    // 下一步切换tab
    tabsChange(val) {
      if (val === "1") {
        if (this.formItem.project_type !== "1") {
          if (this.$common.xeUtils.isEmpty(this.formItem.banks_status)) {
            this.$Message.error("零余额、实体账户、至少选一类");
          } else {
            if (this.showCheckOne) {
              if (
                this.formItem.other_subsidy_bank === undefined ||
                this.formItem.other_subsidy_bank === ""
              ) {
                this.$Message.error("开户银行不能为空");
                return;
              }
            }
            if (this.showCheck) {
              if (
                this.formItem.other_pay_account_banks === undefined ||
                this.formItem.other_pay_account_banks === ""
              ) {
                this.$Message.error("实体账户支付银行不能为空");
                return;
              }
            }
            if (this.showCheckThree) {
              if (
                this.formItem.other_settle_account_banks === undefined ||
                this.formItem.other_settle_account_banks === ""
              ) {
                this.$Message.error("结算银行不能为空");
                return;
              }
            }
            if (this.formItem.pay_account_bank === "其他") {
              if (
                this.formItem.other_pay_account_bank === undefined ||
                this.formItem.other_pay_account_bank === ""
              ) {
                this.$Message.error("支付银行不能为空");
                return;
              }
            }
            if (this.formItem.settle_account_bank === "其他") {
              if (
                this.formItem.other_settle_account_bank === undefined ||
                this.formItem.other_settle_account_bank === ""
              ) {
                this.$Message.error("零余额账户开户银行不能为空");
                return;
              }
            }
            let param = {};
            if (
              this.formItem.subsidy_bank === "" ||
              this.formItem.subsidy_bank === undefined
            ) {
              this.formItem.subsidy_bank = [];
            }
            if (
              this.formItem.pay_account_banks === "" ||
              this.formItem.pay_account_banks === undefined
            ) {
              this.formItem.pay_account_banks = [];
            }
            if (
              this.formItem.settle_account_banks === "" ||
              this.formItem.settle_account_banks === undefined
            ) {
              this.formItem.settle_account_banks = [];
            }
            if (
              this.formItem.pay_account_direct === "" ||
              this.formItem.pay_account_direct === undefined
            ) {
              this.formItem.pay_account_direct = [];
            }
            if (
              this.formItem.settle_account_direct === "" ||
              this.formItem.settle_account_direct === undefined
            ) {
              this.formItem.settle_account_direct = [];
            }
            if (
              this.formItem.subsidy_object === "" ||
              this.formItem.subsidy_object === undefined
            ) {
              this.formItem.subsidy_object = [];
            }
            if (
              this.formItem.settle_object === "" ||
              this.formItem.settle_object === undefined
            ) {
              this.formItem.settle_object = [];
            }
            if (
              this.formItem.subsidy_way === "" ||
              this.formItem.subsidy_way === undefined
            ) {
              this.formItem.subsidy_way = [];
            }
            if (
              this.formItem.subsidy_cash === "" ||
              this.formItem.subsidy_cash === undefined
            ) {
              this.formItem.subsidy_cash = [];
            }
            this.formItem.project_name = this.$common.xeUtils.trim(
              this.formItem.project_name
            );
            this.formItem.budget = this.$common.xeUtils.trim(
              this.formItem.budget
            );
            this.formItem.capital_source = this.$common.xeUtils.trim(
              this.formItem.capital_source
            );
            this.formItem.settle_cycle_other = this.$common.xeUtils.trim(
              this.formItem.settle_cycle_other
            );
            this.formItem.describ = this.$common.xeUtils.trim(
              this.formItem.describ
            );
            this.formItem.basis = this.$common.xeUtils.trim(
              this.formItem.basis
            );
            this.formItem.serve_object = this.$common.xeUtils.trim(
              this.formItem.serve_object
            );
            this.formItem.number = this.$common.xeUtils.trim(
              this.formItem.number
            );
            this.formItem.money = this.$common.xeUtils.trim(
              this.formItem.money
            );
            if (this.optionType === "add") {
              let statisList = JSON.parse(JSON.stringify(this.statisList));
              this.formItem.statisList = statisList;
              this.formItem.statisList.forEach((item) => {
                item.data_content = JSON.stringify(item.data_content);
              });
              let detailList = JSON.parse(JSON.stringify(this.detailList));
              this.formItem.detailList = detailList;
              this.formItem.detailList.forEach((item) => {
                item.data_content = JSON.stringify(item.data_content);
              });

              this.formItem.type = this.salatype;
              this.formItem.ruleList = this.dataList;
              this.formItem.temp_start_time = this.$common.xeUtils.toDateString(
                this.formItem.temp_start_time
              );
              this.formItem.temp_end_time = this.$common.xeUtils.toDateString(
                this.formItem.temp_end_time
              );
              this.formItem.whereList = this.wheredataList;
              this.formItem.yaojianList = this.yaojiandataList;
              this.formItem.yaojianList.forEach((item) => {
                item.file_type = JSON.stringify(item.file_type);
              });

              let publicList = JSON.parse(JSON.stringify(this.publicList));
              // publicList[0].public_start_time = this.$common.xeUtils.toDateString(publicList[0].public_start_time)
              // publicList[0].public_end_time = this.$common.xeUtils.toDateString(publicList[0].public_end_time)
              publicList[0].field = JSON.stringify(publicList[0].field);
              this.formItem.publicList = publicList;
              console.log(this.formItem.publicList, "this.publicList");

              this.formItem.nodeList = this.supervisedataList;
              this.formItem.updateStatus = "2";
              param = this.formItem;
              // this.$delete(param, 'id')
            } else if (this.optionType === "edit") {
              console.log(this.yaojiandataList, "this.yaojiandataList");
              // this.formItem.type = this.salatype
              this.formItem.ruleList = this.dataList;
              this.formItem.timeList = this.timedataList;
              this.formItem.timeList.forEach((item) => {
                item.sj_num = this.$common.xeUtils.toDateString(item.sj_num);
                item.end_time = this.$common.xeUtils.toDateString(
                  item.end_time
                );
              });
              this.formItem.whereList = this.wheredataList;
              this.formItem.yaojianList = this.yaojiandataList;
              this.formItem.yaojianList.forEach((item) => {
                item.file_type = JSON.stringify(item.file_type);
              });
              // this.formItemPublic.public_start_time = this.$common.xeUtils.toDateString(this.formItemPublic.public_start_time)
              // this.formItemPublic.public_end_time = this.$common.xeUtils.toDateString(this.formItemPublic.public_end_time)
              this.formItemPublic.field = JSON.stringify(this.dataPublic);
              this.formItem.publicList = [];
              this.formItem.publicList.push(this.formItemPublic);
              this.formItem.publicList.forEach((item) => {
                delete item.name_en;
                delete item.name_zn;
              });
              this.formItem.nodeList = this.supervisedataList;
              this.formItem.updateStatus = "2";
              param = this.formItem;
              if (this.$route.query.id) param.id = this.$route.query.id;
            }
            this.$refs["formItem"].validate((valid) => {
              if (valid) {
                console.log(val, "val888888");
                val = Number(val);
                console.log(val + 1, "val888888");
                this.name = String(val + 1);
              } else {
                this.$Message.error({
                  content: "操作失败,请核对添加信息后重试",
                });
              }
            });
          }
        }
      } else if (val === "8") {
        this.name = "1";
      } else {
        console.log(val, "val888888");
        val = Number(val);
        console.log(val + 1, "val888888");
        this.name = String(val + 1);
      }
    },
    // 数据统计--------------------------------------------------------------------------------------------------------------------
    statisadd1() {
      this.statisList.push({
        data_content: [],
      });
    },
    statisadd(index) {
      console.log(index);
      this.cnumstatis = index;
      this.formItemstatis.field_name = "";
      this.formItemstatis.company = "";
      this.modalstatisTi = "添加字段";
      this.modalstatisTy = "add";
      this.modalstatis = true;
    },
    statisdelAction(index2) {
      this.statisList.splice(index2, 1);
    },
    statisedit(row, index, index2) {
      console.log(row, index, index2);
      this.cnumstatis = index2;
      this.modalstatisTi = "修改字段";
      this.modalstatisTy = "statisedit";
      this.cindexstatis = index;
      this.formItemstatis = row;
      this.modalstatis = true;
    },
    statisremove(row, index, index2) {
      this.statisList[index2].data_content.splice(index, 1);
    },
    statisok(index) {
      let a = this.cnumstatis;
      if (this.modalstatisTy === "add") {
        this.statisList[a].data_content.push({
          field_name: this.formItemstatis.field_name,
          company: this.formItemstatis.company,
        });
        this.$Message.info("添加成功");
        this.modalstatis = false;
      } else {
        let ci = this.cindexstatis;
        this.statisList[a].data_content[ci].field_name =
          this.formItemstatis.field_name;
        this.statisList[a].data_content[ci].company =
          this.formItemstatis.company;
        this.$Message.success("修改成功");
        this.modalstatis = false;
      }
    },
    statiscancel() {
      this.$Message.info("Clicked cancel");
    },

    // 数据需求明细----------------------------------------------------------
    detailadd1() {
      this.detailList.push({
        data_content: [],
      });
      if (this.yaojiandataList.length >= this.detailList.length) {
        for (const k in this.detailList) {
          this.detailList[k].data_name = this.yaojiandataList[k].yj_title;
        }
      }
    },
    detailadd(index) {
      console.log(index);
      this.cnum = index;
      this.formItemdetail.specific_ruler = "";
      this.formItemdetail.specific_field = "";
      this.modaldetailTi = "添加字段";
      this.modaldetailTy = "add";
      this.modaldetail = true;
    },
    detaildelAction(index2) {
      this.detailList.splice(index2, 1);
    },
    detailedit(row, index, index2) {
      this.cnum = index2;
      this.modaldetailTi = "修改字段";
      this.modaldetailTy = "detailedit";
      this.cindexdetail = index;
      this.formItemdetail = row;
      this.modaldetail = true;
    },
    detailremove(index, index2) {
      this.detailList[index2].data_content.splice(index, 1);
    },
    detailok(index) {
      let a = this.cnum;
      if (this.modaldetailTy === "add") {
        this.detailList[a].data_content.push({
          specific_field: this.formItemdetail.specific_field,
          specific_ruler: this.formItemdetail.specific_ruler,
        });
        this.$Message.info("添加成功");
        this.modaldetail = false;
      } else {
        let ci = this.cindexdetail;
        this.detailList[a].data_content[ci].specific_field =
          this.formItemdetail.specific_field;
        this.detailList[a].data_content[ci].specific_ruler =
          this.formItemdetail.specific_ruler;
        this.$Message.success("修改成功");
        this.modaldetail = false;
      }
    },
    detailcancel() {
      this.$Message.info("Clicked cancel");
    },

    // 时限----------------------------------------------------------
    timeadd() {
      this.timedataList.push({ gov_base_id: this.$route.query.id });
    },
    timedelAction(index) {
      this.timedataList.splice(index, 1);
    },

    // 要件-------------------------------------------------------------------------------------------------------
    uploadImgAction(item, index) {
      let path = item.yi_img_demo;
      this.yaojiancurrentIndex = index;
      this.$refs.imgService.modelAction(path);
    },
    checkBoxChange(val) {
      this.yaojiandataList = this.$common.xeUtils.clone(this.yaojiandataList);
    },
    importImgsResultAction(path, index) {
      this.$set(this.yaojiandataList[index], "yi_img_demo", path);
    },
    yaojianadd() {
      this.yaojiandataList.push({ gov_base_id: this.$route.query.id });
    },
    yaojiandelAction(index) {
      this.yaojiandataList.splice(index, 1);
    },

    // 规则-------------------------------------------------------------------------------------------------------
    add() {
      this.dataList.push({ gov_base_id: this.$route.query.id });
    },
    delAction(index) {
      this.dataList.splice(index, 1);
    },

    // 条件-------------------------------------------------------------------------------------------------------
    whereadd() {
      this.wheredataList.push({ gov_base_id: this.$route.query.id });
    },
    wheredelAction(index) {
      this.wheredataList.splice(index, 1);
    },

    // 公示-------------------------------------------------------------------------------------------------------
    publicadd() {
      // this.publicdataList.push({ gov_base_id: this.$route.query.id })
      this.formItemPublic.name_zn = "";
      // this.formHandling.undertaking = ''
      this.formItemPublic.name_en = "";
      this.modalTi = "添加公示字段";
      this.modalTy = "add";
      this.modalPublic = true;
    },
    edit(row, index) {
      this.modalTi = "修改公示字段";
      this.modalTy = "edit";
      this.cindex = index;
      this.formItemPublic = row;
      this.modalPublic = true;
    },
    remove(index) {
      this.publicList[0].field.splice(index, 1);
    },
    ok() {
      if (this.modalTy === "add") {
        console.log(this.publicList[0].field, this.publicList[0]);
        this.publicList[0].field.push({
          name_en: this.formItemPublic.name_en,
          name_zn: this.formItemPublic.name_zn,
        });
        this.$Message.info("添加成功");
        this.modalPublic = false;
      } else {
        let ci = this.cindex;
        this.publicList[0].field[ci].name_en = this.formItemPublic.name_en;
        this.publicList[0].field[ci].name_zn = this.formItemPublic.name_zn;
        this.$Message.success("修改成功");
        this.modalPublic = false;
      }
    },
    cancel() {
      this.$Message.info("Clicked cancel");
    },
    // --------------------------

    // 监督-------------------------------------------------------------------------------------------------------
    superviseadd() {
      this.supervisedataList.push({ gov_base_id: this.$route.query.id });
    },
    supervisedelAction(index) {
      this.supervisedataList.splice(index, 1);
    },

    // 各个tab页保存-----------------------------------------------------------------–––––--------------------------
    editBtnAction(val) {
      console.log(val, "接收");
      console.log(this.formItem, "this.formItemllll");
      if (val === "base") {
        this.formItem.project_name = this.$common.xeUtils.trim(
          this.formItem.project_name
        );
        this.formItem.budget = this.$common.xeUtils.trim(this.formItem.budget);
        this.formItem.capital_source = this.$common.xeUtils.trim(
          this.formItem.capital_source
        );
        this.formItem.target_no = this.$common.xeUtils.trim(
          this.formItem.target_no
        );
        this.formItem.settle_cycle_other = this.$common.xeUtils.trim(
          this.formItem.settle_cycle_other
        );
        this.formItem.describ = this.$common.xeUtils.trim(
          this.formItem.describ
        );
        this.formItem.basis = this.$common.xeUtils.trim(this.formItem.basis);
        this.formItem.serve_object = this.$common.xeUtils.trim(
          this.formItem.serve_object
        );
        this.formItem.number = this.$common.xeUtils.trim(this.formItem.number);
        this.formItem.money = this.$common.xeUtils.trim(this.formItem.money);
        this.$refs["formItem"].validate((valid) => {
          if (valid) {
            this.formItem.update_status = "2";
            this.formItem.temp_start_time = this.$common.xeUtils.toDateString(
              this.formItem.temp_start_time
            );
            this.formItem.temp_end_time = this.$common.xeUtils.toDateString(
              this.formItem.temp_end_time
            );
            console.log(this.formItem, "this.formItem基础");
            updateSalaryAnnualProjectFund(this.formItem).then((ret) => {
              console.log(ret, "this.formItem基础");
              if (ret.data.errcode === 0) {
                this.$Message.success("修改成功");
              } else {
                this.$Message.error("修改失败" + ret.data.errmsg);
              }
            });
          } else {
            this.$Message.error({
              content: "操作失败,请核对添加信息后重试",
            });
          }
        });
      }
      if (val === "rule") {
        this.formItem.ruleList = this.dataList;
        console.log(this.formItem, "this.formItem规则");
        this.formItem.update_status = "2";
        updateSstGovRule(this.formItem).then((ret) => {
          console.log(ret, "this.formItem规则");
          if (ret.data.errcode === 0) {
            this.$Message.success("修改成功");
          } else {
            this.$Message.error("修改失败" + ret.data.errmsg);
          }
        });
      }
      if (val === "where") {
        this.formItem.whereList = this.wheredataList;
        console.log(this.formItem, "this.formItem条件");
        this.formItem.update_status = "2";
        updateSstGovWhere(this.formItem).then((ret) => {
          console.log(ret, "this.formItem条件");
          if (ret.data.errcode === 0) {
            this.$Message.success("修改成功");
          } else {
            this.$Message.error("修改失败" + ret.data.errmsg);
          }
        });
      }
      if (val === "yaojian") {
        this.formItem.yaoJianList = JSON.parse(
          JSON.stringify(this.yaojiandataList)
        );
        this.formItem.yaoJianList.forEach((item) => {
          item.file_type = JSON.stringify(item.file_type);
        });
        console.log(this.formItem, "this.formItem要件");
        this.formItem.update_status = "2";
        if (this.formItem.yaoJianList) {
          this.formItem.yaoJianList.forEach((item) => {
            item.file_type = JSON.stringify(item.file_type);
          });
        }
        updateSstGovYaojian(this.formItem).then((ret) => {
          console.log(ret, "this.formItem要件");
          if (ret.data.errcode === 0) {
            this.$Message.success("修改成功");
          } else {
            this.$Message.error("修改失败" + ret.data.errmsg);
          }
        });
      }
      if (val === "sjxq") {
        this.formItem.update_status = "2";
        this.formItem.detailList = JSON.parse(JSON.stringify(this.detailList));
        console.log(this.formItem, "this.formItem数据需求");
        if (this.formItem.detailList) {
          this.formItem.detailList.forEach((item) => {
            item.data_content = JSON.stringify(item.data_content);
          });
        }
        updateDataRequirementDetails(this.formItem).then((ret) => {
          console.log(ret, "this.formItem数据需求");
          if (ret.data.errcode === 0) {
            this.$Message.success("修改成功");
          } else {
            this.$Message.error("修改失败" + ret.data.errmsg);
          }
        });
      }
      if (val === "public") {
        this.formItem.update_status = "2";
        let publicList = JSON.parse(JSON.stringify(this.publicList));
        if (publicList) {
          publicList[0].field = JSON.stringify(publicList[0].field);
          // publicList[0].public_start_time = this.$common.xeUtils.toDateString(publicList[0].public_start_time)
          // publicList[0].public_end_time = this.$common.xeUtils.toDateString(publicList[0].public_end_time)
          this.formItem.publicList = publicList;
          console.log(this.formItem.publicList, "ssssss");
          updatePublicityRequirements(this.formItem).then((ret) => {
            console.log(ret, "this.formItem公示");
            if (ret.data.errcode === 0) {
              this.$Message.success("修改成功");
            } else {
              this.$Message.error("修改失败" + ret.data.errmsg);
            }
          });
        }
      }
      if (val === "jiandu") {
        this.formItem.update_status = "2";
        this.formItem.nodeList = this.supervisedataList;
        console.log(this.formItem, "this.formItem监督");
        updateSupervisionNode(this.formItem).then((ret) => {
          console.log(ret, "this.formItem监督");
          if (ret.data.errcode === 0) {
            this.$Message.success("修改成功");
          } else {
            this.$Message.error("修改失败" + ret.data.errmsg);
          }
        });
      }
      if (val === "sjtj") {
        this.formItem.update_status = "2";
        this.formItem.statisList = JSON.parse(JSON.stringify(this.statisList));
        console.log(this.formItem, "this.formItem数据统计");
        if (this.formItem.statisList) {
          this.formItem.statisList.forEach((item) => {
            item.data_content = JSON.stringify(item.data_content);
          });
        }
        updateDataStatistics(this.formItem).then((ret) => {
          console.log(ret, "this.formItem数据统计");
          if (ret.data.errcode === 0) {
            this.$Message.success("修改成功");
          } else {
            this.$Message.error("修改失败" + ret.data.errmsg);
          }
        });
      }
    },
    setFlowDataAction(data) {
      data.map((item) => {
        item.YaoJianList = [];
        item.whereList = [];
        item.ruleList = [];
        item.timeList = [];
        item.compareList = [];
        item.loopList = [];
        item.warningList = [];
        item.nodeList = [];
        item.problemList = [];
        item.evaluateList = [];
        item.powerList = [];
        item.gov_base_id = this.baseInfoId;
        return item;
      });
      this.flowDataList = data;
    },
    resultAction(data) {
      this.flowDataList = data;
    },
    sett(val) {
      let bank = val.toString();
      if (bank.indexOf("99") >= 0) {
        this.showSetto = true;
      } else {
        this.showSetto = false;
        delete this.formItem.settle_object_other;
      }
    },
    setto(val) {
      let bank = val.toString();
      if (bank.indexOf("99") >= 0) {
        this.showSetto = true;
      } else {
        this.showSetto = false;
        delete this.formItem.settle_object_other;
      }
    },
    subway(val) {
      let bank = val.toString();
      if (bank.indexOf("99") >= 0) {
        this.showSubway = true;
      } else {
        this.showSubway = false;
        delete this.formItem.subsidy_way_other;
      }
    },
    subobj(val) {
      let bank = val.toString();
      if (bank.indexOf("99") >= 0) {
        this.showSubobj = true;
      } else {
        this.showSubobj = false;
        delete this.formItem.subsidy_object_other;
      }
    },
    selectOptionOne(val) {
      let banks = val.toString();
      if (banks.indexOf("其他") >= 0) {
        this.showCheckOne = true;
      } else {
        this.showCheckOne = false;
        delete this.formItem.other_subsidy_bank;
      }
    },
    selectOptionTwo(val) {
      console.log(val);
      let banks = val.toString();
      if (banks.indexOf("零余额账户开户银行") >= 0) {
        this.showCheck1 = true;
      } else {
        this.showCheck1 = false;
      }
      // delete this.formItem.other_pay_account_banks
      if (banks.indexOf("实体账户支付银行") >= 0) {
        this.showCheck2 = true;
      } else {
        this.showCheck2 = false;
      }
    },
    selectOption(val) {
      let banks = val.toString();
      if (banks.indexOf("其他") >= 0) {
        this.showCheckThree = true;
      } else {
        this.showCheckThree = false;
        delete this.formItem.other_settle_account_banks;
      }
    },
    getInfoByID() {
      selectById({ id: this.projectID }).then((ret) => {
        console.log(ret, "888288");
        let data = ret.data;
        if (data.errcode === 0) {
          this.updateStatus = ret.data.data.update_status;
          if (this.updateStatus) {
            this.updateStatus = "2";
          }
          // console.log(this.updateStatus, typeof (this.updateStatus), 'opppp')
          if (ret.data.data.pay_account_banks) {
            ret.data.data.pay_account_banks = JSON.parse(
              ret.data.data.pay_account_banks
            );
          }
          if (ret.data.data.banks_status) {
            ret.data.data.banks_status = JSON.parse(ret.data.data.banks_status);
          }
          if (ret.data.data.settle_account_direct) {
            ret.data.data.settle_account_direct = JSON.parse(
              ret.data.data.settle_account_direct
            );
          }
          if (ret.data.data.statisList) {
            let statisList = JSON.parse(
              JSON.stringify(ret.data.data.statisList)
            );
            statisList.forEach((item) => {
              item.data_content = JSON.parse(item.data_content);
            });
            this.statisList = statisList;
          }
          if (ret.data.data.detailList) {
            let detailList = this.$common.xeUtils.clone(
              ret.data.data.detailList
            );
            detailList.forEach((item) => {
              item.data_content = JSON.parse(item.data_content);
            });
            this.detailList = detailList;
          }
          if (ret.data.data.ruleList) {
            this.dataList = this.$common.xeUtils.clone(ret.data.data.ruleList);
          }
          if (ret.data.data.timeList) {
            this.timedataList = this.$common.xeUtils.clone(
              ret.data.data.timeList
            );
          }
          if (ret.data.data.whereList) {
            this.wheredataList = this.$common.xeUtils.clone(
              ret.data.data.whereList
            );
          }
          if (ret.data.data.yaoJianList) {
            this.yaojiandataList = this.$common.xeUtils.clone(
              ret.data.data.yaoJianList
            );
            this.yaojiandataList.forEach((item) => {
              if (item.file_type) {
                item.file_type = JSON.parse(item.file_type);
              }
            });
          }
          this.timedataList = this.$common.xeUtils.clone(
            ret.data.data.timeList
          );
          if (ret.data.data.publicList) {
            let publicList = this.$common.xeUtils.clone(
              ret.data.data.publicList
            );
            // this.publicList = this.$common.xeUtils.clone(ret.data.data.publicList)
            publicList[0].field = JSON.parse(publicList[0].field);
            this.publicList = publicList;
          }

          this.supervisedataList = this.$common.xeUtils.clone(
            ret.data.data.nodeList
          );
          this.formItem = data.data;
          if (this.formItem.type === "1") {
            this.headTitle = "惠民资金";
            this.headTitlet = "惠民直达事项名称";
          }
          if (this.formItem.type === "2") {
            this.headTitle = "惠企资金";
            this.headTitlet = "惠企直达事项名称";
          }
          // console.log(this.formItem.subsidy_bank.toString(), '6666')
          // 9月7日
          let banks1 = this.formItem.banks_status.toString();
          if (banks1.indexOf("零余额账户开户银行") >= 0) {
            this.showCheck1 = true;
            console.log(this.formItem.other_pay_account_banks);
          } else {
            this.showCheck1 = false;
          }
          // delete this.formItem.other_pay_account_banks
          if (banks1.indexOf("实体账户支付银行") >= 0) {
            console.log(this.formItem.other_pay_account_banks);
            this.showCheck2 = true;
            console.log(this.formItem.other_pay_account_banks);
          } else {
            this.showCheck2 = false;
          }

          let banks = this.formItem.subsidy_bank.toString();
          if (banks.indexOf("其他") >= 0) {
            this.showCheckOne = true;
          } else {
            this.showCheckOne = false;
            delete this.formItem.other_subsidy_bank;
          }
          // let bank1 = this.formItem.pay_account_banks.toString()
          // if (bank1.indexOf('其他') >= 0) {
          //   this.showCheck = true
          // } else {
          //   this.showCheck = false
          //   delete this.formItem.other_pay_account_banks
          // }
          // let bank2 = this.formItem.settle_account_banks.toString()
          // if (bank2.indexOf('其他') >= 0) {
          //   this.showCheckThree = true
          // } else {
          //   this.showCheckThree = false
          //   delete this.formItem.other_settle_account_banks
          // }
          let bank3 = this.formItem.settle_object.toString();
          if (bank3.indexOf("99") >= 0) {
            this.showSetto = true;
          } else {
            this.showSetto = false;
            delete this.formItem.settle_object_other;
          }
          let bank4 = this.formItem.subsidy_way.toString();
          if (bank4.indexOf("99") >= 0) {
            this.showSubway = true;
          } else {
            this.showSubway = false;
            delete this.formItem.subsidy_way_other;
          }
          let bank5 = this.formItem.subsidy_object.toString();
          if (bank5.indexOf("99") >= 0) {
            this.showSubobj = true;
          } else {
            this.showSubobj = false;
            delete this.formItem.subsidy_object_other;
          }
        } else {
          this.error(data);
        }
      });
    },
    saveBtnAction() {
      if (this.formItem.project_type === "1") {
        if (
          this.$common.xeUtils.isEmpty(this.formItem.subsidy_bank) &&
          this.$common.xeUtils.isEmpty(this.formItem.subsidy_cash)
        ) {
          this.$Message.error("补贴代发银行、现金发放至少选一类");
        } else {
          if (this.$common.xeUtils.isEmpty(this.formItem.banks_status)) {
            this.$Message.error("零余额、实体账户、至少选一类");
          } else {
            if (this.showCheckOne) {
              if (
                this.formItem.other_subsidy_bank === undefined ||
                this.formItem.other_subsidy_bank === ""
              ) {
                this.$Message.error("开户银行不能为空");
                return;
              }
            }
            if (this.showCheck) {
              if (
                this.formItem.other_pay_account_banks === undefined ||
                this.formItem.other_pay_account_banks === ""
              ) {
                this.$Message.error("实体账户支付银行不能为空");
                return;
              }
            }
            if (this.showCheckThree) {
              if (
                this.formItem.other_settle_account_banks === undefined ||
                this.formItem.other_settle_account_banks === ""
              ) {
                this.$Message.error("结算银行不能为空");
                return;
              }
            }
            if (this.formItem.pay_account_bank === "其他") {
              if (
                this.formItem.other_pay_account_bank === undefined ||
                this.formItem.other_pay_account_bank === ""
              ) {
                this.$Message.error("实体账户支付银行不能为空");
                return;
              }
            }
            if (this.formItem.settle_account_bank === "其他") {
              if (
                this.formItem.other_settle_account_bank === undefined ||
                this.formItem.other_settle_account_bank === ""
              ) {
                this.$Message.error("零余额账户开户银行不能为空");
                return;
              }
            }
            let param = {};
            if (
              this.formItem.subsidy_bank === "" ||
              this.formItem.subsidy_bank === undefined
            ) {
              this.formItem.subsidy_bank = [];
            }
            if (
              this.formItem.pay_account_banks === "" ||
              this.formItem.pay_account_banks === undefined
            ) {
              this.formItem.pay_account_banks = [];
            }
            if (
              this.formItem.settle_account_banks === "" ||
              this.formItem.settle_account_banks === undefined
            ) {
              this.formItem.settle_account_banks = [];
            }
            if (
              this.formItem.pay_account_direct === "" ||
              this.formItem.pay_account_direct === undefined
            ) {
              this.formItem.pay_account_direct = [];
            }
            if (
              this.formItem.settle_account_direct === "" ||
              this.formItem.settle_account_direct === undefined
            ) {
              this.formItem.settle_account_direct = [];
            }
            if (
              this.formItem.subsidy_object === "" ||
              this.formItem.subsidy_object === undefined
            ) {
              this.formItem.subsidy_object = [];
            }
            if (
              this.formItem.settle_object === "" ||
              this.formItem.settle_object === undefined
            ) {
              this.formItem.settle_object = [];
            }
            if (
              this.formItem.subsidy_way === "" ||
              this.formItem.subsidy_way === undefined
            ) {
              this.formItem.subsidy_way = [];
            }
            if (
              this.formItem.subsidy_cash === "" ||
              this.formItem.subsidy_cash === undefined
            ) {
              this.formItem.subsidy_cash = [];
            }
            this.formItem.project_name = this.$common.xeUtils.trim(
              this.formItem.project_name
            );
            this.formItem.budget = this.$common.xeUtils.trim(
              this.formItem.budget
            );
            this.formItem.capital_source = this.$common.xeUtils.trim(
              this.formItem.capital_source
            );
            this.formItem.target_no = this.$common.xeUtils.trim(
              this.formItem.target_no
            );
            this.formItem.settle_cycle_other = this.$common.xeUtils.trim(
              this.formItem.settle_cycle_other
            );
            this.formItem.describ = this.$common.xeUtils.trim(
              this.formItem.describ
            );
            this.formItem.basis = this.$common.xeUtils.trim(
              this.formItem.basis
            );
            this.formItem.serve_object = this.$common.xeUtils.trim(
              this.formItem.serve_object
            );
            this.formItem.number = this.$common.xeUtils.trim(
              this.formItem.number
            );
            this.formItem.money = this.$common.xeUtils.trim(
              this.formItem.money
            );
            if (this.optionType === "add") {
              let statisList = JSON.parse(JSON.stringify(this.statisList));
              this.formItem.statisList = statisList;
              this.formItem.statisList.forEach((item) => {
                item.data_content = JSON.stringify(item.data_content);
              });
              let detailList = JSON.parse(JSON.stringify(this.detailList));
              this.formItem.detailList = detailList;
              this.formItem.detailList.forEach((item) => {
                item.data_content = JSON.stringify(item.data_content);
              });
              this.formItem.type = this.salatype;
              this.formItem.ruleList = this.dataList;
              this.formItem.temp_start_time = this.$common.xeUtils.toDateString(
                this.formItem.temp_start_time
              );
              this.formItem.temp_end_time = this.$common.xeUtils.toDateString(
                this.formItem.temp_end_time
              );
              this.formItem.whereList = this.wheredataList;
              console.log(this.formItem.whereList, " this.formItem.whereList");
              this.formItem.yaojianList = JSON.parse(
                JSON.stringify(this.yaojiandataList)
              );
              this.formItem.yaojianList.forEach((item) => {
                item.file_type = JSON.stringify(item.file_type);
              });

              let publicList = JSON.parse(JSON.stringify(this.publicList));
              // publicList[0].public_start_time = this.$common.xeUtils.toDateString(publicList[0].public_start_time)
              // publicList[0].public_end_time = this.$common.xeUtils.toDateString(publicList[0].public_end_time)
              publicList[0].field = JSON.stringify(publicList[0].field);
              this.formItem.publicList = publicList;
              console.log(this.formItem.publicList, "this.publicList");

              this.formItem.nodeList = this.supervisedataList;
              this.formItem.updateStatus = "2";
              param = this.formItem;
              // this.$delete(param, 'id')
            } else if (this.optionType === "edit") {
              // this.formItem.type = this.salatype
              this.formItem.ruleList = this.dataList;
              this.formItem.timeList = this.timedataList;
              this.formItem.timeList.forEach((item) => {
                item.sj_num = this.$common.xeUtils.toDateString(item.sj_num);
                item.end_time = this.$common.xeUtils.toDateString(
                  item.end_time
                );
              });
              this.formItem.whereList = this.wheredataList;
              this.formItem.yaojianList = this.yaojiandataList;
              this.formItem.yaojianList.forEach((item) => {
                item.file_type = JSON.stringify(item.file_type);
              });
              // this.formItemPublic.public_start_time = this.$common.xeUtils.toDateString(this.formItemPublic.public_start_time)
              // this.formItemPublic.public_end_time = this.$common.xeUtils.toDateString(this.formItemPublic.public_end_time)
              this.formItemPublic.field = JSON.stringify(this.dataPublic);
              this.publicdataList = [];
              this.publicdataList.push(this.formItemPublic);
              this.formItem.publicList = this.publicdataList;
              this.formItem.publicList.forEach((item) => {
                delete item.name_en;
                delete item.name_zn;
              });
              this.formItem.nodeList = this.supervisedataList;
              this.formItem.updateStatus = "2";
              param = this.formItem;
              if (this.$route.query.id) param.id = this.$route.query.id;
            }
            this.$refs["formItem"].validate((valid) => {
              if (valid) {
                if (this.optionType === "add") {
                  console.log(param, "paramadd");
                  this.addDataAction(param);
                } else if (this.optionType === "edit") {
                  this.updateDataAction(param);
                  console.log(param, "paramaedit");
                }
              } else {
                this.$Message.error({
                  content: "操作失败,请核对添加信息后重试",
                });
              }
            });
          }
        }
      } else if (this.formItem.project_type !== "1") {
        if (this.$common.xeUtils.isEmpty(this.formItem.banks_status)) {
          this.$Message.error("零余额、实体账户、市财政直接拨付至少选一类");
        } else {
          if (this.showCheckOne) {
            if (
              this.formItem.other_subsidy_bank === undefined ||
              this.formItem.other_subsidy_bank === ""
            ) {
              this.$Message.error("开户银行不能为空");
              return;
            }
          }
          if (this.showCheck) {
            if (
              this.formItem.other_pay_account_banks === undefined ||
              this.formItem.other_pay_account_banks === ""
            ) {
              this.$Message.error("实体账户支付银行不能为空");
              return;
            }
          }
          if (this.showCheckThree) {
            if (
              this.formItem.other_settle_account_banks === undefined ||
              this.formItem.other_settle_account_banks === ""
            ) {
              this.$Message.error("结算银行不能为空");
              return;
            }
          }
          if (this.formItem.pay_account_bank === "其他") {
            if (
              this.formItem.other_pay_account_bank === undefined ||
              this.formItem.other_pay_account_bank === ""
            ) {
              this.$Message.error("支付银行不能为空");
              return;
            }
          }
          if (this.formItem.settle_account_bank === "其他") {
            if (
              this.formItem.other_settle_account_bank === undefined ||
              this.formItem.other_settle_account_bank === ""
            ) {
              this.$Message.error("零余额账户开户银行不能为空");
              return;
            }
          }
          let param = {};
          if (
            this.formItem.subsidy_bank === "" ||
            this.formItem.subsidy_bank === undefined
          ) {
            this.formItem.subsidy_bank = [];
          }
          if (
            this.formItem.pay_account_banks === "" ||
            this.formItem.pay_account_banks === undefined
          ) {
            this.formItem.pay_account_banks = [];
          }
          if (
            this.formItem.settle_account_banks === "" ||
            this.formItem.settle_account_banks === undefined
          ) {
            this.formItem.settle_account_banks = [];
          }
          if (
            this.formItem.pay_account_direct === "" ||
            this.formItem.pay_account_direct === undefined
          ) {
            this.formItem.pay_account_direct = [];
          }
          if (
            this.formItem.settle_account_direct === "" ||
            this.formItem.settle_account_direct === undefined
          ) {
            this.formItem.settle_account_direct = [];
          }
          if (
            this.formItem.subsidy_object === "" ||
            this.formItem.subsidy_object === undefined
          ) {
            this.formItem.subsidy_object = [];
          }
          if (
            this.formItem.settle_object === "" ||
            this.formItem.settle_object === undefined
          ) {
            this.formItem.settle_object = [];
          }
          if (
            this.formItem.subsidy_way === "" ||
            this.formItem.subsidy_way === undefined
          ) {
            this.formItem.subsidy_way = [];
          }
          if (
            this.formItem.subsidy_cash === "" ||
            this.formItem.subsidy_cash === undefined
          ) {
            this.formItem.subsidy_cash = [];
          }
          this.formItem.project_name = this.$common.xeUtils.trim(
            this.formItem.project_name
          );
          this.formItem.budget = this.$common.xeUtils.trim(
            this.formItem.budget
          );
          this.formItem.capital_source = this.$common.xeUtils.trim(
            this.formItem.capital_source
          );
          this.formItem.target_no = this.$common.xeUtils.trim(
            this.formItem.target_no
          );
          this.formItem.settle_cycle_other = this.$common.xeUtils.trim(
            this.formItem.settle_cycle_other
          );
          this.formItem.describ = this.$common.xeUtils.trim(
            this.formItem.describ
          );
          this.formItem.basis = this.$common.xeUtils.trim(this.formItem.basis);
          this.formItem.serve_object = this.$common.xeUtils.trim(
            this.formItem.serve_object
          );
          this.formItem.number = this.$common.xeUtils.trim(
            this.formItem.number
          );
          this.formItem.money = this.$common.xeUtils.trim(this.formItem.money);
          if (this.optionType === "add") {
            let statisList = JSON.parse(JSON.stringify(this.statisList));
            this.formItem.statisList = statisList;
            this.formItem.statisList.forEach((item) => {
              item.data_content = JSON.stringify(item.data_content);
            });
            let detailList = JSON.parse(JSON.stringify(this.detailList));
            this.formItem.detailList = detailList;
            this.formItem.detailList.forEach((item) => {
              item.data_content = JSON.stringify(item.data_content);
            });

            this.formItem.type = this.salatype;
            this.formItem.ruleList = this.dataList;
            this.formItem.temp_start_time = this.$common.xeUtils.toDateString(
              this.formItem.temp_start_time
            );
            this.formItem.temp_end_time = this.$common.xeUtils.toDateString(
              this.formItem.temp_end_time
            );
            this.formItem.whereList = this.wheredataList;
            console.log(this.formItem.whereList, " this.formItem.whereList");
            this.formItem.yaojianList = JSON.parse(
              JSON.stringify(this.yaojiandataList)
            );
            this.formItem.yaojianList.forEach((item) => {
              item.file_type = JSON.stringify(item.file_type);
            });

            let publicList = JSON.parse(JSON.stringify(this.publicList));
            // publicList[0].public_start_time = this.$common.xeUtils.toDateString(publicList[0].public_start_time)
            // publicList[0].public_end_time = this.$common.xeUtils.toDateString(publicList[0].public_end_time)
            publicList[0].field = JSON.stringify(publicList[0].field);
            this.formItem.publicList = publicList;
            console.log(this.formItem.publicList, "this.publicList");

            this.formItem.nodeList = this.supervisedataList;
            this.formItem.updateStatus = "2";
            param = this.formItem;
            // this.$delete(param, 'id')
          } else if (this.optionType === "edit") {
            console.log(this.yaojiandataList, "this.yaojiandataList");
            // this.formItem.type = this.salatype
            this.formItem.ruleList = this.dataList;
            this.formItem.timeList = this.timedataList;
            this.formItem.timeList.forEach((item) => {
              item.sj_num = this.$common.xeUtils.toDateString(item.sj_num);
              item.end_time = this.$common.xeUtils.toDateString(item.end_time);
            });
            this.formItem.whereList = this.wheredataList;
            this.formItem.yaojianList = this.yaojiandataList;
            this.formItem.yaojianList.forEach((item) => {
              item.file_type = JSON.stringify(item.file_type);
            });
            // this.formItemPublic.public_start_time = this.$common.xeUtils.toDateString(this.formItemPublic.public_start_time)
            // this.formItemPublic.public_end_time = this.$common.xeUtils.toDateString(this.formItemPublic.public_end_time)
            this.formItemPublic.field = JSON.stringify(this.dataPublic);
            this.formItem.publicList = [];
            this.formItem.publicList.push(this.formItemPublic);
            this.formItem.publicList.forEach((item) => {
              delete item.name_en;
              delete item.name_zn;
            });
            this.formItem.nodeList = this.supervisedataList;
            this.formItem.updateStatus = "2";
            param = this.formItem;
            if (this.$route.query.id) param.id = this.$route.query.id;
          }
          this.$refs["formItem"].validate((valid) => {
            if (valid) {
              if (this.optionType === "add") {
                console.log(param, "paramadd");
                this.addDataAction(param);
              } else if (this.optionType === "edit") {
                console.log(param, "paramedit");
                this.updateDataAction(param);
              }
            } else {
              this.$Message.error({
                content: "操作失败,请核对添加信息后重试",
              });
            }
          });
        }
      }
    },
    updateDataAction(param) {
      console.log(param, "修改");
      let stas = param.type;
      this.btnLoading = true;
      projectUpdate(param).then((ret) => {
        let data = ret.data;
        if (data.errcode === 0) {
          this.btnLoading = false;
          this.$Message.success("操作成功");
          this.$router.push({
            name: "privateList",
            query: { sts: stas },
          });
          // this.$router.push({ name: 'projectList' })
        } else {
          this.btnLoading = false;
          this.error(data);
        }
      });
    },
    addDataAction(param) {
      this.btnLoading = true;
      insert(param).then((ret) => {
        // console.log(ret, 'ret!!!add')
        this.rtobj = ret.data.data;
        let data = ret.data;
        if (data.errcode === 0) {
          this.btnLoading = false;
          this.success();
          this.$router.push({
            name: "privateList",
            query: { sts: this.salatype },
          });
          console.log(param, "添加");
        } else {
          this.btnLoading = false;
          this.error(data);
          this.$router.push({ name: "privateList" });
        }
      });
    },
    // confirmd () {
    //   this.$Modal.confirm({
    //     title: '请前往完善行权事项信息',
    //     content: '<p>请前往完善行权事项信息</p>',
    //     loading: true,
    //     onOk: () => {
    //       setTimeout(() => {
    //         this.$Modal.remove()
    //         this.$router.push({
    //           name: 'createList',
    //           query: { id: this.rtobj.id, vtype: '2', project_name: this.rtobj.project_name }
    //         })
    //       }, 200)
    //     }
    //   })
    // },
    success(val) {
      val = this.$common.xeUtils.isEmpty(val) ? "操作成功" : val;
      this.$Message.success(val);
    },
    error(data) {
      this.$Message.error({
        content: "操作失败,\n" + data.errmsg,
      });
    },
    checkTrue() {
    this.formItem.yaoJianList = JSON.parse(JSON.stringify(this.yaojiandataList))
        // this.formItem.yaoJianList.forEach(item => {
        //   item.file_type = JSON.stringify(item.file_type)
        // })
        console.log(this.formItem, 'this.formItem要件')
        this.formItem.update_status = '2'
        if (this.formItem.yaoJianList) {
          this.formItem.yaoJianList.forEach(item => {
            item.file_type = JSON.stringify(item.file_type)
          })
        }
        updateSstGovYaojianScience(this.formItem).then(ret => {
          console.log(ret, 'this.formItem要件')
          if (ret.data.errcode === 0) {
            this.$Message.success('审查成功')
          } else {
            this.$Message.error('审查失败' + ret.data.errmsg)
          }
        })
    },
  },
};
</script>

<style scoped lang="less">
.type-style /deep/ .ivu-col-span-8 {
  margin-left: -4%;
}
.type-style-one /deep/ .ivu-col-span-8 {
  margin-left: -2%;
}
.type-style-three /deep/ .ivu-col-span-8 {
  margin-left: -11%;
}
.type-style-four /deep/ .ivu-col-span-8 {
  margin-left: -3%;
}
.type-style-five /deep/ .ivu-col-span-8 {
  margin-left: -11%;
}
.input-one {
  margin-left: 10px;
}

.form-block-inner {
  height: 100%;
}

.tag-box {
  margin-bottom: 10px;
}

/deep/ .ivu-col-span-2 {
  margin-top: 23px;
}

.button-group {
  text-align: center;
}

.upload-icon {
  padding-left: 10px;
}

/deep/ .ivu-tooltip {
  /*width: 100%;*/
}

.excel-help {
  display: inline-block;
  margin-left: 10px;
  font-size: 16px;
  color: orange;
  cursor: pointer;
}

.other-style {
  width: 100%;
  height: 40px;
  margin-bottom: 23px;
  display: none;
  margin-left: -2%;
}
.other-style .ivu-form-item {
  width: 100%;
}
.wer {
  display: flex;
  flex-direction: column;
}
.wer .ivu-checkbox-wrapper {
  height: 42px;
  margin-top: 26px;
}
/deep/ .ivu-upload {
  display: none !important;
}
/deep/ .ivu-modal-footer {
  display: none;
}
/deep/ .ivu-icon-ios-trash-outline {
  display: none !important;
}
</style>
